package com.example.shop.util;

import com.example.shop.Constant;
import com.example.sjlibrary.net.BaseJSONOverListener;
import com.example.sjlibrary.net.BaseNetForJSON;
import com.example.sjlibrary.net.BaseParams;
import com.example.sjlibrary.net.http.HttpForJSONByGet;
import com.example.sjlibrary.net.http.HttpForJSONByPost;

/**
 * Created by Administrator on 2016/3/15.
 */
public class HttpNetUtil {
    public  static BaseNetForJSON getNetRequest(String url, BaseParams baseParams, Class classEntityType, BaseJSONOverListener baseJSONOverListener){
        if (Constant.SC_NET_COMMON_METHOD==BaseNetForJSON.NET_GET){
            return  new HttpForJSONByGet(url,baseParams,classEntityType,baseJSONOverListener);
        }
        if (Constant.SC_NET_COMMON_METHOD==BaseNetForJSON.NET_POST){
            return  new HttpForJSONByPost(url,baseParams,classEntityType,baseJSONOverListener);
        }
        throw new RuntimeException("no such net method surpported!!!");
    }
    public  static BaseNetForJSON getNetRequest(String url, Class classEntityType, BaseJSONOverListener baseJSONOverListener){
        if (Constant.SC_NET_COMMON_METHOD==BaseNetForJSON.NET_GET){
            return  new HttpForJSONByGet(url,classEntityType,baseJSONOverListener);
        }
        if (Constant.SC_NET_COMMON_METHOD==BaseNetForJSON.NET_POST){
            return  new HttpForJSONByPost(url,classEntityType,baseJSONOverListener);
        }
        throw new RuntimeException("no such net method surpported!!!");
    }
}
